From 04d5c477aaeeb6a267437b772a2ccb52dda9ff9e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sun, 29 Aug 2010 12:37:58 +0200 Subject: [PATCH] API: Remove gdk_drawable_get_colormap() And with it, remove any notion of colormaps from GdkWindow. In particular, X11 windows will now not set attrs.colormap when calling XCreateWindow. --- docs/reference/gdk/gdk3-sections.txt | 1 - docs/reference/gdk/tmpl/drawing.sgml | 9 ------ gdk/gdk.symbols | 1 - gdk/gdkdraw.c | 17 ---------- gdk/gdkdrawable.h | 3 -- gdk/gdkoffscreenwindow.c | 21 ------------ gdk/gdkwindow.c | 14 -------- gdk/quartz/gdkdrawable-quartz.c | 13 -------- gdk/quartz/gdkdrawable-quartz.h | 2 -- gdk/quartz/gdkwindow-quartz.c | 27 +--------------- gdk/win32/gdkdrawable-win32.c | 10 ------ gdk/win32/gdkdrawable-win32.h | 1 - gdk/win32/gdkwindow-win32.c | 32 +------------------ gdk/x11/gdkdrawable-x11.c | 14 -------- gdk/x11/gdkdrawable-x11.h | 2 -- gdk/x11/gdkwindow-x11.c | 48 +--------------------------- 16 files changed, 3 insertions(+), 212 deletions(-) diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 341a9841ba..e3e651f030 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -285,7 +285,6 @@ gdk_color_get_type Drawing Primitives drawing GdkDrawable -gdk_drawable_get_colormap gdk_drawable_get_size gdk_drawable_get_clip_region gdk_drawable_get_visible_region diff --git a/docs/reference/gdk/tmpl/drawing.sgml b/docs/reference/gdk/tmpl/drawing.sgml index 1c3df57cc3..7850f00a93 100644 --- a/docs/reference/gdk/tmpl/drawing.sgml +++ b/docs/reference/gdk/tmpl/drawing.sgml @@ -72,15 +72,6 @@ or a #GdkWindow. @colormap: - - - - - -@drawable: -@Returns: - - diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 03631bd2bf..9264ce1d16 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -533,7 +533,6 @@ gdk_drag_get_protocol #if IN_HEADER(__GDK_DRAWABLE_H__) #if IN_FILE(__GDK_DRAW_C__) gdk_drawable_get_clip_region -gdk_drawable_get_colormap gdk_drawable_get_size gdk_drawable_get_type G_GNUC_CONST gdk_drawable_get_visible_region diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index a6acb8ca38..1e03392f16 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -81,23 +81,6 @@ gdk_drawable_get_size (GdkDrawable *drawable, GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height); } -/** - * gdk_drawable_get_colormap: - * @drawable: a #GdkDrawable - * - * Gets the colormap for @drawable, if one is set; returns - * %NULL otherwise. - * - * Return value: the colormap, or %NULL - **/ -GdkColormap* -gdk_drawable_get_colormap (GdkDrawable *drawable) -{ - g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL); - - return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable); -} - /** * gdk_drawable_get_clip_region: * @drawable: a #GdkDrawable diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h index 9e281994e0..c052ee408d 100644 --- a/gdk/gdkdrawable.h +++ b/gdk/gdkdrawable.h @@ -60,8 +60,6 @@ struct _GdkDrawableClass gint *width, gint *height); - GdkColormap* (*get_colormap) (GdkDrawable *drawable); - cairo_region_t* (*get_clip_region) (GdkDrawable *drawable); cairo_region_t* (*get_visible_region) (GdkDrawable *drawable); @@ -92,7 +90,6 @@ GType gdk_drawable_get_type (void) G_GNUC_CONST; void gdk_drawable_get_size (GdkDrawable *drawable, gint *width, gint *height); -GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable); cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable); cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable); diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 3994235813..c46b8f2442 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -51,7 +51,6 @@ struct _GdkOffscreenWindow GdkDrawable parent_instance; GdkWindow *wrapper; - GdkColormap *colormap; GdkScreen *screen; cairo_surface_t *surface; @@ -109,9 +108,6 @@ gdk_offscreen_window_destroy (GdkWindow *window, if (!recursing) gdk_offscreen_window_hide (window); - - g_object_unref (offscreen->colormap); - offscreen->colormap = NULL; } static gboolean @@ -140,14 +136,6 @@ gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable) return cairo_surface_reference (offscreen->surface); } -static GdkColormap* -gdk_offscreen_window_get_colormap (GdkDrawable *drawable) -{ - GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable); - - return offscreen->colormap; -} - void _gdk_offscreen_window_new (GdkWindow *window, GdkScreen *screen, @@ -173,14 +161,6 @@ _gdk_offscreen_window_new (GdkWindow *window, offscreen->screen = screen; - if (gdk_screen_get_system_visual (screen) == private->visual) - { - offscreen->colormap = gdk_screen_get_system_colormap (screen); - g_object_ref (offscreen->colormap); - } - else - offscreen->colormap = gdk_colormap_new (private->visual, FALSE); - offscreen->surface = gdk_window_create_similar_surface ((GdkWindow *)private->parent, CAIRO_CONTENT_COLOR, private->width, @@ -705,7 +685,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass) object_class->finalize = gdk_offscreen_window_finalize; drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface; - drawable_class->get_colormap = gdk_offscreen_window_get_colormap; } static void diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index b8e7d7b1e3..40252bef5b 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -227,8 +227,6 @@ static void gdk_window_real_get_size (GdkDrawable *drawable, gint *width, gint *height); -static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable); - static cairo_region_t* gdk_window_get_clip_region (GdkDrawable *drawable); static cairo_region_t* gdk_window_get_visible_region (GdkDrawable *drawable); @@ -374,7 +372,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass) object_class->get_property = gdk_window_get_property; drawable_class->get_size = gdk_window_real_get_size; - drawable_class->get_colormap = gdk_window_real_get_colormap; drawable_class->ref_cairo_surface = gdk_window_ref_cairo_surface; drawable_class->create_cairo_surface = gdk_window_create_cairo_surface; drawable_class->set_cairo_clip = gdk_window_set_cairo_clip; @@ -3659,17 +3656,6 @@ gdk_window_real_get_size (GdkDrawable *drawable, *height = private->height; } -static GdkColormap* -gdk_window_real_get_colormap (GdkDrawable *drawable) -{ - g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL); - - if (GDK_WINDOW_DESTROYED (drawable)) - return NULL; - - return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl); -} - static void gdk_window_drop_cairo_surface (GdkWindowObject *private) { diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 8124973a9b..4dbce4b049 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -106,20 +106,9 @@ gdk_quartz_ref_cairo_surface (GdkDrawable *drawable) return impl->cairo_surface; } -static GdkColormap* -gdk_quartz_get_colormap (GdkDrawable *drawable) -{ - return GDK_DRAWABLE_IMPL_QUARTZ (drawable)->colormap; -} - static void gdk_drawable_impl_quartz_finalize (GObject *object) { - GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (object); - - if (impl->colormap) - g_object_unref (impl->colormap); - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -135,8 +124,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass) drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface; drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface; - - drawable_class->get_colormap = gdk_quartz_get_colormap; } GType diff --git a/gdk/quartz/gdkdrawable-quartz.h b/gdk/quartz/gdkdrawable-quartz.h index 80c351ac00..52a9bef5d5 100644 --- a/gdk/quartz/gdkdrawable-quartz.h +++ b/gdk/quartz/gdkdrawable-quartz.h @@ -46,8 +46,6 @@ struct _GdkDrawableImplQuartz GdkDrawable *wrapper; - GdkColormap *colormap; - cairo_surface_t *cairo_surface; }; diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 7e7d1ce787..43c4915952 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -833,29 +833,6 @@ _gdk_window_impl_new (GdkWindow *window, } } - if (!private->input_only) - { - if (private->visual == gdk_screen_get_system_visual (_gdk_screen)) - { - draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); - } - else if (private->visual == gdk_screen_get_rgba_visual (_gdk_screen)) - { - draw_impl->colormap = gdk_screen_get_rgba_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); - } - else - { - draw_impl->colormap = gdk_colormap_new (private->visual, FALSE); - } - } - else - { - draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); - } - /* Maintain the z-ordered list of children. */ if (private->parent != (GdkWindowObject *)_gdk_root) parent_impl->sorted_children = g_list_prepend (parent_impl->sorted_children, window); @@ -922,7 +899,7 @@ _gdk_window_impl_new (GdkWindow *window, gdk_window_set_title (window, title); - if (draw_impl->colormap == gdk_screen_get_rgba_colormap (_gdk_screen)) + if (gdk_window_get_visual (window) == gdk_screen_get_rgba_visual (_gdk_screen)) { [impl->toplevel setOpaque:NO]; [impl->toplevel setBackgroundColor:[NSColor clearColor]]; @@ -1048,8 +1025,6 @@ _gdk_windowing_window_init (void) drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (private->impl); drawable_impl->wrapper = GDK_DRAWABLE (private); - drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (drawable_impl->colormap); } static void diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 849c901add..beafd7b227 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -53,8 +53,6 @@ static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable, int width, int height); -static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable); - static void gdk_drawable_impl_win32_finalize (GObject *object); static const cairo_user_data_key_t gdk_win32_cairo_key; @@ -72,8 +70,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface; drawable_class->create_cairo_surface = gdk_win32_create_cairo_surface; - - drawable_class->get_colormap = gdk_win32_get_colormap; } static void @@ -91,12 +87,6 @@ gdk_drawable_impl_win32_finalize (GObject *object) * Win32 specific implementations of generic functions * *****************************************************/ -static GdkColormap* -gdk_win32_get_colormap (GdkDrawable *drawable) -{ - return GDK_DRAWABLE_IMPL_WIN32 (drawable)->colormap; -} - /* Drawing */ diff --git a/gdk/win32/gdkdrawable-win32.h b/gdk/win32/gdkdrawable-win32.h index 32649d8403..fba149a24c 100644 --- a/gdk/win32/gdkdrawable-win32.h +++ b/gdk/win32/gdkdrawable-win32.h @@ -49,7 +49,6 @@ struct _GdkDrawableImplWin32 { GdkDrawable parent_instance; GdkDrawable *wrapper; - GdkColormap *colormap; HANDLE handle; guint hdc_count; diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index fdae033085..9869a8e19a 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -37,7 +37,6 @@ #include "gdkdevicemanager-win32.h" #include "gdkenumtypes.h" -static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable); static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window); static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass); static void gdk_window_impl_win32_finalize (GObject *object); @@ -126,13 +125,10 @@ static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); parent_class = g_type_class_peek_parent (klass); object_class->finalize = gdk_window_impl_win32_finalize; - - drawable_class->get_colormap = gdk_window_impl_win32_get_colormap; } static void @@ -189,25 +185,6 @@ _gdk_win32_adjust_client_rect (GdkWindow *window, API_CALL (AdjustWindowRectEx, (rect, style, FALSE, exstyle)); } -static GdkColormap* -gdk_window_impl_win32_get_colormap (GdkDrawable *drawable) -{ - GdkDrawableImplWin32 *drawable_impl; - - g_return_val_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable), NULL); - - drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable); - - if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only && - drawable_impl->colormap == NULL) - { - drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (drawable_impl->colormap); - } - - return drawable_impl->colormap; -} - void _gdk_root_window_size_init (void) { @@ -242,8 +219,6 @@ _gdk_windowing_window_init (GdkScreen *screen) draw_impl->handle = GetDesktopWindow (); draw_impl->wrapper = GDK_DRAWABLE (private); - draw_impl->colormap = gdk_screen_get_default_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); private->window_type = GDK_WINDOW_ROOT; private->depth = gdk_visual_get_system ()->depth; @@ -486,9 +461,6 @@ _gdk_window_impl_new (GdkWindow *window, dwExStyle = 0; private->input_only = FALSE; - - draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); } else { @@ -499,9 +471,7 @@ _gdk_window_impl_new (GdkWindow *window, dwExStyle = WS_EX_TRANSPARENT; private->depth = 0; private->input_only = TRUE; - draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen); - g_object_ref (draw_impl->colormap); - GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY, system colormap\n")); + GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n")); } switch (private->window_type) diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index fda1299710..c8a38f4d87 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -44,8 +44,6 @@ static cairo_surface_t *gdk_x11_create_cairo_surface (GdkDrawable *drawable, int width, int height); -static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable); - static const cairo_user_data_key_t gdk_x11_cairo_key; G_DEFINE_TYPE (GdkDrawableImplX11, _gdk_drawable_impl_x11, GDK_TYPE_DRAWABLE) @@ -57,8 +55,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass) drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface; drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface; - - drawable_class->get_colormap = gdk_x11_get_colormap; } static void @@ -110,16 +106,6 @@ _gdk_x11_drawable_update_size (GdkDrawable *drawable) * X11 specific implementations of generic functions * *****************************************************/ -static GdkColormap* -gdk_x11_get_colormap (GdkDrawable *drawable) -{ - GdkDrawableImplX11 *impl; - - impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - return impl->colormap; -} - static GdkDrawable * get_impl_drawable (GdkDrawable *drawable) { diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h index f499455110..d4660df12b 100644 --- a/gdk/x11/gdkdrawable-x11.h +++ b/gdk/x11/gdkdrawable-x11.h @@ -54,8 +54,6 @@ struct _GdkDrawableImplX11 GdkDrawable *wrapper; - GdkColormap *colormap; - Window xid; GdkScreen *screen; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index bbdd0805d0..7b338bf72b 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -110,7 +110,6 @@ static void move_to_current_desktop (GdkWindow *window); static void gdk_window_x11_set_background (GdkWindow *window, cairo_pattern_t *pattern); -static GdkColormap* gdk_window_impl_x11_get_colormap (GdkDrawable *drawable); static void gdk_window_impl_x11_finalize (GObject *object); static void gdk_window_impl_iface_init (GdkWindowImplIface *iface); @@ -175,11 +174,8 @@ static void gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); object_class->finalize = gdk_window_impl_x11_finalize; - - drawable_class->get_colormap = gdk_window_impl_x11_get_colormap; } static void @@ -422,34 +418,6 @@ _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window) _gdk_x11_window_tmp_reset_bg (window, FALSE); } -static GdkColormap* -gdk_window_impl_x11_get_colormap (GdkDrawable *drawable) -{ - GdkDrawableImplX11 *drawable_impl; - - g_return_val_if_fail (GDK_IS_WINDOW_IMPL_X11 (drawable), NULL); - - drawable_impl = GDK_DRAWABLE_IMPL_X11 (drawable); - - if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only && - drawable_impl->colormap == NULL) - { - XWindowAttributes window_attributes; - GdkVisual *visual; - - XGetWindowAttributes (GDK_SCREEN_XDISPLAY (drawable_impl->screen), - drawable_impl->xid, - &window_attributes); - - visual = gdk_x11_screen_lookup_visual (drawable_impl->screen, - window_attributes.visual->visualid); - drawable_impl->colormap = gdk_x11_colormap_foreign_new (visual, - window_attributes.colormap); - } - - return drawable_impl->colormap; -} - void _gdk_windowing_window_init (GdkScreen * screen) { @@ -476,8 +444,6 @@ _gdk_windowing_window_init (GdkScreen * screen) draw_impl->screen = screen; draw_impl->xid = screen_x11->xroot_window; draw_impl->wrapper = GDK_DRAWABLE (private); - draw_impl->colormap = gdk_screen_get_system_colormap (screen); - g_object_ref (draw_impl->colormap); private->window_type = GDK_WINDOW_ROOT; private->depth = DefaultDepthOfScreen (screen_x11->xscreen); @@ -762,16 +728,6 @@ _gdk_window_impl_new (GdkWindow *window, { class = InputOutput; - if ((gdk_screen_get_system_visual (screen)) == private->visual) - { - draw_impl->colormap = gdk_screen_get_system_colormap (screen); - g_object_ref (draw_impl->colormap); - } - else - { - draw_impl->colormap = gdk_colormap_new (private->visual, FALSE); - } - xattributes.background_pixel = BlackPixel (xdisplay, screen_x11->screen_num); xattributes.border_pixel = BlackPixel (xdisplay, screen_x11->screen_num); @@ -800,8 +756,6 @@ _gdk_window_impl_new (GdkWindow *window, else { class = InputOnly; - draw_impl->colormap = gdk_screen_get_system_colormap (screen); - g_object_ref (draw_impl->colormap); } if (private->width > 65535 || @@ -5440,7 +5394,7 @@ _gdk_windowing_window_beep (GdkWindow *window) * On X11, this works only on X screens with a compositing manager * running. * - * For setting up per-pixel alpha, see gdk_screen_get_rgba_colormap(). + * For setting up per-pixel alpha, see gdk_screen_get_rgba_visual(). * For making non-toplevel windows translucent, see * gdk_window_set_composited(). * -- 2.30.2